using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Web.UI.WebControls;

namespace Heckel.EasyTools.Diagramming
{
    [Serializable()]
    public class DiagramNode
    {
        private string _imageUrl;
        public string ImageUrl
        {
            get { return _imageUrl; }
            set { _imageUrl = value; }
        }

        private string _nodeText;
        public string NodeText
        {
            get { return _nodeText; }
            set { _nodeText = value; }
        }

        private string _nodeDescription;
        public string NodeDescription
        {
            get { return _nodeDescription; }
            set { _nodeDescription = value; }
        }

        private int _nodeUniqueIdentifier;
        public int NodeUniqueIdentifier
        {
            get { return _nodeUniqueIdentifier; }
            set 
            { 
                _nodeUniqueIdentifier = value; 
            }
        }

        private string _nodeID;
        public string NodeID
        {
            get { return _nodeID; }
            set { _nodeID = value; }
        }

        private int _xPos;
        public int XPos
        {
            get { return _xPos; }
            set { _xPos = value; }
        }

        private int _yPos;
        public int YPos
        {
            get { return _yPos; }
            set { _yPos = value; }
        }
       
        private List<string> _parentOfIds;
        public List<string> ParentOfIds
        {
            get { return _parentOfIds; }
            set { _parentOfIds = value; }
        }
        
        private List<string> _childOfIds;
        public List<string> ChildOfIds
        {
            get { return _childOfIds; }
            set { _childOfIds = value; }
        }

        private Unit _width;
        public Unit Width
        {
            get { return _width;}
            set { _width = value; }
        }

        private Unit _height;
        public Unit Height
        {
            get { return _height;}
            set { _height = value; }
        }

        private Color _backColor;
        public Color BackColor
        {
            get { return _backColor; }
            set { _backColor = value; }
        }

        private Color _foreColor;
        public Color ForeColor
        {
            get { return _foreColor; }
            set { _foreColor = value; }
        }

        private Color _borderColor;
        public Color BorderColor
        {
            get { return _borderColor; }
            set { _borderColor = value; }
        }

        private string _detailsButtonText;
        public string DetailsButtonText
        {
            get { return _detailsButtonText;}
            set { _detailsButtonText = value; }
        }

        private string _deleteNodeCssClass;
        public string DeleteNodeCssClass
        {
            get { return _deleteNodeCssClass; }
            set { _deleteNodeCssClass = value; }
        }

        private string _nodeLineColor = "";
        public string NodeLineColor
        {
            get { return _nodeLineColor; }
            set { _nodeLineColor = value; }
        }

        private int _nodeLinePixelWidth = -1;
        public int NodeLinePixelWidth
        {
            get { return _nodeLinePixelWidth; }
            set { _nodeLinePixelWidth = value; }
        }

        private LineType _nodeLineType = LineType.Undefined;
        public LineType NodeLineType
        {
            get { return _nodeLineType; }
            set { _nodeLineType = value; }
        }

        private LineDecoration _nodeLineDecoration = LineDecoration.Undefined;
        public LineDecoration NodeLineDecoration
        {
            get { return _nodeLineDecoration; }
            set { _nodeLineDecoration = value; }
        }

        private bool _lockChildrenToXPlaneOnDrag = false;
        public bool LockChildrenToXPlaneOnDrag
        {
            get { return _lockChildrenToXPlaneOnDrag; }
            set { _lockChildrenToXPlaneOnDrag = value; }
        }

        private bool _lockChildrenToYPlaneOnDrag = false;
        public bool LockChildrenToYPlaneOnDrag
        {
            get { return _lockChildrenToYPlaneOnDrag; }
            set { _lockChildrenToYPlaneOnDrag = value; }
        }

        private bool _autoSnapChildrenBelow = false;
        public bool AutoSnapChildrenBelow
        {
            get { return _autoSnapChildrenBelow; }
            set { _autoSnapChildrenBelow = value; }
        }

        private TextPosition _textPlacement = TextPosition.BelowImage;
        public TextPosition TextPlacement
        {
            get { return _textPlacement; }
            set { _textPlacement = value; }
        }

        private bool _draggingEnabled = true;
        public bool DraggingEnabled
        {
            get { return _draggingEnabled; }
            set { _draggingEnabled = value; }
        }

        private bool _drawParentLines = true;
        public bool DrawParentLines
        {
            get { return _drawParentLines; }
            set { _drawParentLines = value; }
        }

        private bool _drawChildLines = true;
        public bool DrawChildLines
        {
            get { return _drawChildLines; }
            set { _drawChildLines = value; }
        }

        public DiagramNode(string imageUrl, string dependencyName, string dependencyDescription, 
            string nodeID, int nodeUniqueIdentifier, int xPos, int yPos, List<string> parentOf, 
            List<string> childOf)
        {
            this._imageUrl = imageUrl;
            this._xPos = xPos;
            this._yPos = yPos;
            //if (DiagramUniqueIdentifier != "" && dependencyClientID.IndexOf(DiagramUniqueIdentifier) == -1)
             //   this._dependencyClientID = dependencyClientID + "_" + DiagramUniqueIdentifier; 
            //else
            this._nodeUniqueIdentifier = nodeUniqueIdentifier;
            this._nodeText = dependencyName;
            this._nodeDescription = dependencyDescription;
            this._nodeID = nodeID;
            this._childOfIds = childOf;
            this._parentOfIds = parentOf;
        }

        public void RemoveAllParent()
        {
 
            this._parentOfIds.Clear();
        }
        public void RemoveAllChild()
        {
           
            this._childOfIds.Clear();
            
        }
    }
}
